$(function () {
    //页面加载请求评论列表
    $.ajax({
        url: BigNew.comment_list,
        type: 'get',
        dataType: 'json',
        data: {
            page: 1,
            perpage: 10
        },
        success: function (backData) {
            console.log(backData);
            $('.table tbody').html(template('comment', backData))
            //初始化分页插件
            $('#pagination').twbsPagination({
                totalPages: backData.data.totalPage,
                visiblePages: 6,
                first: '首页',
                prev: '上一页',
                next: '下一页',
                last: '尾页',
                onPageClick: function (event, page) {
                    $('#page-content').text('Page ' + page);
                    $.ajax({
                        url: BigNew.comment_list,
                        type: 'get',
                        dataType: 'json',
                        data: {
                            page: page,
                            perpage: 10,
                        },
                        success: function (backData) {
                            $('.table tbody').html(template('comment', backData))
                        }
                    })
                }
            });
        }
    })
})